//
//  DetailViewController.m
//  MapCallouts
//
//  Created by Hideo Tomizu on 10/08/24.
//  Copyright 2010 株式会社ビットウェイ. All rights reserved.
//

#import "DetailViewController.h"
#import "AppDelegate.h"
#import "DamInfo.h"

@implementation DetailViewController

@synthesize dam_cd;
@synthesize damInfo;
//@synthesize text1;
@synthesize label1;

/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];

//	AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
//	DamInfo *damInfo = [DamInfo getDamInfoDetail:[appDelegate getDBPath] damCd:dam_cd];

	
	[self setDamInfo];
}

- (void) setDamInfo {
	NSLog(@"%d:damcd",dam_cd);
	AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
	self.damInfo = [DamInfo getDamInfoDetail:[appDelegate getDBPath] damCd:dam_cd];
	self.title = self.damInfo.dam_name;
	
	/*
	// とりあえずラベルに表示
	text1.text = [NSString stringWithFormat:@"ダム名:%@ \n所在地:%@%@ \n水系名:%@ \n河川名:%@ \n形式:%@ \n目的:%@ \n堤高:%f m \n堤高長:%f m \n堤体積:%d ㎥ \n総貯水量:%d ㎥",
				  self.damInfo.dam_name,
				  self.damInfo.ken_name,
				  self.damInfo.address,
				  self.damInfo.water_name,
				  self.damInfo.river_name,
				  self.damInfo.type_name,
				  self.damInfo.purpose_name,
				  self.damInfo.height,
				  self.damInfo.width,
				  self.damInfo.volume,
				  self.damInfo.pondage
				  ];
	 */
	label1.text = [NSString stringWithFormat:@"%@",self.damInfo.dam_name];

	

}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
	[damInfo release];
    [super dealloc];
}


@end
